{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Installation Guide for SpaCon\n", "\n", "This guide will walk you through setting up an isolated Python environment using `conda` and installing the necessary packages, including `spacon`, `torch`, and `torch_geometric`.\n", "\n", "\n", "---\n", "\n", "\n", "> **Prerequisites** \n", " \n", " \n", "\n", "\n", "Before you begin, ensure you have Anaconda or Miniconda installed on your system. If not, you can download it from the [official Anaconda website](https://www.anaconda.com/products/distribution).\n", "\n", "You will also need an NVIDIA GPU with a driver that supports the version of CUDA you intend to use.\n", "\n", "> **Step 1: Create a Conda Virtual Environment**\n", "\n", "First, create a new virtual environment to isolate our project dependencies. We will name this environment `spacon-env`. Open your terminal or Anaconda Prompt and execute the following command:\n", "\n", "```bash\n", "conda create --name spacon-env python=3.10\n", "```\n", "\n", "This command creates a new environment with Python 3.10. When prompted to proceed, type `y` and press Enter.\n", " \n", "Once the environment is created, activate it:\n", "\n", "```bash\n", "conda activate spacon-env\n", "```\n", "\n", "Your terminal prompt should now be prefixed with `(spacon-env)`.\n", "\n", "> **Step 2: Install spacon**\n", "\n", "With the `spacon-env` environment activated, the first package we will install is `spacon`.\n", "\n", "```bash\n", "pip install spacon\n", "```\n", "\n", "> **Step 3: Install PyTorch**\n", "\n", "Next, we will install PyTorch.\n", "\n", "**Note:** The PyTorch installation command depends on your Operating System, package manager (pip, conda), and desired CUDA version. The command below is just an example for `torch==2.5.0` with `CUDA 12.4`.\n", "\n", "It is highly recommended that you visit the [official PyTorch website (previous versions)](https://pytorch.org/get-started/previous-versions/) to find the correct installation command for your specific setup.\n", "\n", "Example installation command:\n", "\n", "```bash\n", "pip install torch==2.5.0 torchvision==0.20.0 torchaudio==2.5.0 --index-url https://download.pytorch.org/whl/cu124\n", "```\n", "\n", "> **Step 4: Install torch_geometric**\n", "\n", "After successfully installing PyTorch, you can install `torch_geometric`.\n", "\n", "```bash\n", "pip install torch_geometric\n", "```\n", "\n", "> **Step 5: Install torch_geometric Dependencies**\n", "\n", "Finally, we need to install the necessary dependencies for `torch_geometric` that are compatible with our specific PyTorch and CUDA versions.\n", "\n", "**Note:** The URL specified with the `-f` flag must match your version of `torch` and CUDA.\n", "\n", "Please refer to the [official PyTorch Geometric installation documentation](https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html) to find the correct URL for your build.\n", "\n", "The URL `https://data.pyg.org/whl/torch-2.5.0+cu124.html` in the command below corresponds to `torch-2.5.0` and `cu124`. You must adjust this URL according to your versions.\n", "\n", "```bash\n", "pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.5.0+cu124.html\n", "```\n", "\n", "> **Verification**\n", "\n", "To ensure that all packages have been installed correctly, you can run the following Python script:\n", "\n", "```python\n", "import spacon\n", "import torch\n", "import torch_geometric\n", "\n", "print(f\"PyTorch version: {torch.__version__}\")\n", "print(f\"CUDA available: {torch.cuda.is_available()}\")\n", "if torch.cuda.is_available():\n", " print(f\"CUDA version: {torch.version.cuda}\")\n", "print(f\"torch_geometric version: {torch_geometric.__version__}\")\n", "```\n", "\n", "You have now successfully set up your Python environment with all the required packages." ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }